<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>预定义常量</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mcrypt.resources.html">资源类型</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mcrypt.ciphers.html">Mcrypt ciphers</a></div>
 <div class="up"><a href="book.mcrypt.html">Mcrypt</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mcrypt.constants" class="appendix">
 <h1>预定义常量</h1>

 <p class="simpara">下列常量由此扩展定义，且仅在此扩展编译入 PHP 或在运行时动态载入时可用。</p>
 <p class="para">
  Mcrypt can operate in four block cipher modes (<em>CBC</em>,
  <em>OFB</em>, <em>CFB</em>, and
  <em>ECB</em>). If linked against libmcrypt-2.4.x or higher the
  functions can also operate in the block cipher mode <em>nOFB</em>
  and in <em>STREAM</em> mode. Below you find a list with all
  supported encryption modes together with the constants that are
  defines for the encryption mode.  For a more complete reference and
  discussion see Applied Cryptography by Schneier (ISBN 0-471-11709-9).
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <strong><code>MCRYPT_MODE_ECB</code></strong> (<em>electronic
     codebook</em>) is suitable for random data,
     such as encrypting other keys. Since data there is short and random,
     the disadvantages of ECB have a favorable negative effect.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <strong><code>MCRYPT_MODE_CBC</code></strong> (<em>cipher block
     chaining</em>) is especially suitable for
     encrypting files where the security is increased over <em>ECB</em>
     significantly.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <strong><code>MCRYPT_MODE_CFB</code></strong> (<em>cipher
     feedback</em>) is the best mode for encrypting byte
     streams where single bytes must be encrypted.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <strong><code>MCRYPT_MODE_OFB</code></strong> (<em>output feedback, in
     8bit</em>) is comparable to <em>CFB</em>, but
     can be used in applications where error propagation cannot
     be tolerated. It&#039;s insecure (because it operates in 8bit
     mode) so it is not recommended to use it.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <strong><code>MCRYPT_MODE_NOFB</code></strong> (<em>output feedback,
     in nbit</em>) is comparable to OFB, but
     more secure because it operates on the block size of the algorithm.
    </span>
   </li> 
   <li class="listitem">
    <span class="simpara">
     <strong><code>MCRYPT_MODE_STREAM</code></strong> is an extra mode to include
     some stream algorithms like <em>&quot;WAKE&quot;</em> or <em>&quot;RC4&quot;</em>.
    </span>
   </li> 
  </ul>
 </p>

 <p class="para">
  Some other mode and random device constants:
  <dl>

   
    <dt id="constant.mcrypt-encrypt">
     <strong><code>MCRYPT_ENCRYPT</code></strong> 
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      
     </span>
    </dd>

   
   
    <dt id="constant.mcrypt-decrypt">
     <strong><code>MCRYPT_DECRYPT</code></strong> 
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      
     </span>
    </dd>

   
   
    <dt id="constant.mcrypt-dev-random">
     <strong><code>MCRYPT_DEV_RANDOM</code></strong> 
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      
     </span>
    </dd>

   
   
    <dt id="constant.mcrypt-dev-urandom">
     <strong><code>MCRYPT_DEV_URANDOM</code></strong> 
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      
     </span>
    </dd>

   
   
    <dt id="constant.mcrypt-rand">
     <strong><code>MCRYPT_RAND</code></strong> 
     (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      
     </span>
    </dd>

   
  </dl>

 </p>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mcrypt.resources.html">资源类型</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mcrypt.ciphers.html">Mcrypt ciphers</a></div>
 <div class="up"><a href="book.mcrypt.html">Mcrypt</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
